#ifndef REUTERSDOCUMENT_HPP
#define REUTERSDOCUMENT_HPP

#include <QList>
#include <QString>
#include <QAbstractTableModel>

class ReutersDocument : public QAbstractTableModel {
public:

    enum class LewisSplit {
        Train,
        Test,
        NotUsed
    };

    enum class CgiSplit {
        Train,
        Test
    };

    static ReutersDocument NULL_DOC;

private:

    bool loaded_;

    QString file_;

    QString oldId_;

    QString newId_;

    LewisSplit LewisSplit_;

    CgiSplit cgiSplit_;

    QList <QString> topics_;

    QList <QString> assignedTopics_;

    QList <QString> places_;

    QList <QString> people_;

    QList <QString> orgs_;

    QList <QString> exchanges_;

    QList <QString> companies_;

    QString title_;

    QString dateline_;

    QString body_;

public:

    ReutersDocument (QString file, QString title);

    virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;

    virtual int columnCount(const QModelIndex & parent = QModelIndex()) const;

    virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;

    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;

    void assignTopic (const QString& topic) {
        assignedTopics_.push_back(topic);
    }

    bool loaded () const {
        return loaded_;
    }

    void setLoaded (bool loaded) {
        loaded_ = loaded;
    }

    const QString& file () const {
        return file_;
    }

    const QString& oldId () const {
        return  oldId_;
    }

    const QString& newId () const {
        return newId_;
    }

    LewisSplit LewisSplit () const {
        return LewisSplit_;
    }

    CgiSplit cgiSplit () const {
        return cgiSplit_;
    }

    const QList <QString>& realTopics () const {
        return topics_;
    }

    const QList <QString>& assignedTopics () const {
        return assignedTopics_;
    }

    void addTopic (const QString& topic) {
        topics_.push_back(topic);
    }

    const QList <QString>& places () const {
        return places_;
    }

    void addPlace (const QString& place) {
        places_.push_back(place);
    }

    const QList <QString>& people () const {
        return people_;
    }

    void addPerson (const QString& person) {
        people_.push_back(person);
    }

    const QList <QString>& orgs () const {
        return orgs_;
    }

    void addOrg (const QString& org) {
        orgs_.push_back(org);
    }

    const QList <QString>& exchanges () const {
        return exchanges_;
    }

    void addExchange (const QString& exchange) {
        exchanges_.push_back(exchange);
    }

    const QList <QString>& companies () const {
        return companies_;
    }

    void addCompany (const QString& company) {
        companies_.push_back(company);
    }

    const QString& title () const {
        return title_;
    }

    void setTitle (const QString& title) {
        title_ = title;
    }

    const QString& dateline () const {
        return dateline_;
    }

    void setDateline (const QString& dateline) {
        dateline_ = dateline;
    }

    const QString& body () const {
        return body_;
    }

    void setBody (const QString& body) {
        body_ = body;
    }

};

#endif // REUTERSDOCUMENT_HPP
